<div class="layui-fluid" id="VIEW-list-table" lay-title="短信发送">
    <div class="layui-row layui-col-space12">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body ">
                    <form class="layui-form" action="" lay-filter="form-group">
                        <div class="layui-form-item">
                            <label class="layui-form-label" >手机号：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="phone" autocomplete="off" placeholder="请输入手机号" class="layui-input">
                            </div>
                            <!--<label class="layui-form-label" >订单号：</label>
                            <div class="layui-input-inline">
                                <input type="text" name="orderNumber" autocomplete="off" placeholder="请输入订单号" class="layui-input">
                            </div>-->

                            <a class="layui-btn search_btn" data-type="getInfo" style="margin-left: 15px;">查询</a>
                            <a class="layui-btn add_btn" data-type="getInfo" style="margin-left: 15px;">发送</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body nepadmin-table-full">
                    <div class="layui-btn-container nepadmin-pad-t10 nepadmin-pad-l10">
                        <!--<div class="layui-btn layui-btn-sm add">发送</div>-->
                        <!--<div class="layui-btn layui-btn-sm layui-btn-primary delete-action" data-type="del">删除</div>-->
                    </div>
                    <table id="list-table-send-sms" lay-filter="list-table-send-sms"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['admin', 'table', 'form', 'jquery'], function () {
        var $ = layui.jquery
            , layer = layui.layer
            , form = layui.form
            , admin = layui.admin;
        var view = $('#VIEW-list-table');
        var table = layui.table;
        var tableFilter = 'list-table-send-sms';
        table.render({
            elem: '[lay-filter="' + tableFilter + '"]',
            url: '/sysSendSms/page?token=' + admin.loginToken,
            height: 'full-165',
            cols: [[
                {title: '', type: 'checkbox', fixed: true, width: 60},
                {
                    title: '类型', width: 160, templet: function (d) {
                    var status = {
                        1: {title: '订货客户通知', color: 'blue'},
                        2: {title: '被代发客户通知', color: 'orange'}
                    }[d.status];
                    return '<span class="layui-badge layui-bg-' + status.color + '">' + status.title + '</span>';
                }
                },
                {title: '手机号',width: 160, field: 'phone'},
                {title: '商品', width: 140,field: 'product'},
                {title: '物流', field: 'logistics'},
                {title: '单号', field: 'code'},
                {title: '发送时间', field: 'time', align: 'center', minWidth: 250, templet: function (d) {
                    var createTime = layui.util.toDateString(d.createTime, 'yyyy-MM-dd HH:mm:ss')
                    return '<p><span title="' + d.createTime + '" class="nepadmin-c-gray">' + createTime + '</span></p>';
                }
                }
            ]]
        });

        view.find('.search_btn').on("click",function(){
            // 查询
            table.reload("list-table-send-sms",{
                url: '/sysSendSms/page?token=' + admin.loginToken,
                page: {
                    curr: 1 //重新从第 1 页开始
                },
                where: {
                    phone:$("input[name=phone]").val()
                }
            })
        });

        view.find('.add_btn').click(function () {
            admin.popup({
                url: '/sys/sms/sysSendSmsEdit',
                area: ['600px', '460px'],
                data : {
                    table:table
                }
            });
            return false
        });

    })
</script>